﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<link href="<%= request.getContextPath() %>/css/schedule.css" rel="stylesheet" type="text/css" />

<div class="left left-content">
	<div id="searchBox">
		<div class="searchForm">
			<s:form action="/home/search" method="get">
			<s:textfield id="keyword" name="keyword" size="50" />
			<input type="submit" value="Tìm kiếm">
			<label>Gợi ý: có thể tìm theo tên phòng khám, tên bác sĩ hoặc địa chỉ phòng khám</label>
			<br/>
			Chuyên khoa <s:select list="specialties" name="selectedSpecialtyId" id="selectedSpecialtyId" listKey="specialtyId" listValue="name"></s:select>  
			Tỉnh thành <s:select list="provinces" name="selectedProvinceId" id="selectedProvinceId" listKey="provinceId" listValue="name"></s:select>
			</s:form>
		</div>
	</div>
	<div class="searchResult">
		<div class="seachHeading">Kết quả tìm kiếm</div>
		<div class="resultList">
			<s:if test="%{result.size() > 0}">
				<ul>
				<s:iterator value="result" status="location" id="aLocation">
					<li>
						<div class="left">
							<s:if test='%imageUrl != null && imageUrl != ""'>
								<img src='/home/getImage?pic=<s:property value="imageUrl" />' width="100" />
							</s:if>
							<s:else>
								<img src='<%=request.getContextPath() %>/images/hospital-default.png' width="100" />
							</s:else>
						</div>
						<div class="left" style="width: 440px">
							<s:if test="%{username == null || username == ''}">
								<a href='/home/detail/<s:property value="locationId"/>'>
								<s:property value="name"/></a>
							</s:if>
							<s:else>
								<a href='/<s:property value="username"/>' >
								<s:property value="name"/></a>
							</s:else>
							<br />
							Địa chỉ: <s:property value="address"/><br />
							<s:if test="%doctorName != null">
								Bác sĩ: <s:property value="doctorName"/><br />
							</s:if>
							Chuyên khoa: <s:property value="specialties"/><br />
							<div class="info"><s:property value="info"/></div>
							<s:if test="%{turnOnBooking == true}">
								<div><a href='/<s:property value="username"/>' class="button">Đặt lịch hẹn</a></div>
							</s:if>
						</div>
					</li>
				</s:iterator>
				</ul>
			</s:if>
			<s:if test="%{result.size() == 0}">
				Không có kết quả nào phù hợp
			</s:if>
		</div>
		<s:if test="%{totalPage > 1}">
		<div class="pagination left">
			<s:url forceAddSchemeHostAndPort="true" includeParams="all" var="url"/>
			<ul>
				<s:if test="%{page > 1}">
					<li>
						<a href='<s:property value="@com.ohs.fo.action.HomeAction@addPageParam(#url)"/><s:property value="page - 1"/>'><span class="prev"><<</span></a>
					</li>
				</s:if>
				
				<s:iterator begin="%{begin}" end="%{end}">
					<s:if test="%{page == top}">
						<li>
							<span class="page curpage"><s:property value="top"/></span>
						</li>
					</s:if>
					<s:else>
						<li>
							<a href='<s:property value="@com.ohs.fo.action.HomeAction@addPageParam(#url)"/><s:property value="top"/>'><span class="page"><s:property value="top"/></span></a>
						</li>
					</s:else>
				</s:iterator>
				
				<s:if test="%{page < totalPage}">
					<li>
						<a href='<s:property value="@com.ohs.fo.action.HomeAction@addPageParam(#url)"/><s:property value="page + 1"/>'><span class="next">>></span></a>
					</li>
				</s:if>
			</ul>
		</div>
		</s:if>
	</div>
</div>

<jsp:include page="include/right-ads.jsp"></jsp:include>
